#include "mytools.h"
#include "QString"

QString mytools::getResPath(){
    return robot::path_res;
}

QString mytools::catenatePath(){
    return "";
}

QString mytools::getImgPath(QString imgName){
    return ":/" + getResPath() + "/" + imgName;
}

struct_img* mytools::loadImgByPath(QString imgName){
    struct_img *ret = new struct_img;
    QImage *image = new QImage();
    image->load(mytools::getImgPath(imgName));
    ret->imgName = imgName;
    ret->img = image;
    ret->pix = QPixmap::fromImage(*image);
    ret->icon = QIcon(mytools::getImgPath(imgName));
    return ret;
}

void mytools::closeImgByStruct(struct_img *s_img){
    delete s_img->img;
    //delete s_img->icon;
    //delete img->pix;
}
